﻿using System;
using System.Collections.Generic;

namespace OMC.DataManagement
{
    /// <summary>
    /// this is a Folder which represent a folder of the outlook inbox
    /// a folder could contain a FolderName and a list of MailContents
    /// </summary>
    /// <remarks>
    /// Copyright 2012 Stefan Lütolf
    /// </remarks>
    public class Folder
    {
        /// <summary>
        /// The Name of the Folder, its similar to the Folder in Outlook
        /// </summary>
        public string TheFolderName { get; set; }
        /// <summary>
        /// The folder path of the folder, it contains the whole folder path, similar to the path
        /// in outlook
        /// </summary>
        public string FolderInfo { get; set; }
        List<MailContent> TheMailList;

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="inFolderName">the name of the outlook mail folder</param>
        /// <param name="inFolderInfo">to determine the folder</param>
        public Folder(String inFolderName, String inFolderInfo)
        {
            this.TheFolderName = inFolderName;
            this.FolderInfo = inFolderInfo;
            TheMailList = new List<MailContent>();
        }

        /// <summary>
        /// to add mail to the Maillist
        /// </summary>
        /// <param name="inBody">The Body of the mail</param>
        /// <param name="inSubject">the subject of the mail</param>
        /// <param name="inSender">the sender mail address of the mail</param>
        /// <param name="inTo">the receiver mail address of the mail</param>
        public void addMailContent(String inBody, String inSubject, String inSender, String inTo)
        {
            TheMailList.Add(new MailContent(inBody, inSubject, inSender, inTo));
        }

        /// <summary>
        /// enum, to go throw the list
        /// </summary>
        /// <returns>elements</returns>
        public IEnumerator<MailContent> GetEnumerator()
        {
            foreach (MailContent TheMailContent in TheMailList)
            {
                yield return TheMailContent;
            }
        }
    }
}